<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class TestController extends BaseController
{
    public function testSignature(Request $request)
    {
        $openid    = trim($request->get('openid'));
        $user_id   = intval($request->get('user_id'));
        $signature = trim($request->get('signature'));

        if(empty($openid) || empty($user_id) || empty($signature))
        {
            return $this->err(1,200,'','参数错误');
        }

        $ret = $this->verify_signature($user_id,$openid,$signature);
        if($ret)
        {
            return $this->ok([],'签名通过');
        }
        return $this->err(1,200,'','签名失败');
    }
}
